package com.sxt.springcloud.bus;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sxt.bus.domain.Goods;
import com.baomidou.mybatisplus.extension.service.IService;
import com.sxt.bus.domain.Provider;
import com.sxt.bus.vo.GoodsVo;
import com.sxt.springcloud.bus.fallback.GoodsClientFallbackService;
import com.sxt.sys.common.AppFileUtils;
import com.sxt.sys.common.Constast;
import com.sxt.sys.common.DataGridView;
import com.sxt.sys.common.ResultObj;
import org.apache.commons.lang3.StringUtils;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * <p>
 * 服务类
 * </p>
 *
 * @author author
 * @since 2019-12-24
 */
@Component
@FeignClient(value = "SPRINGCLOUD-PROVIDER-BUS",fallbackFactory = GoodsClientFallbackService.class)
@RequestMapping("/p/goods")
public interface GoodsClientService {
    /**
     * 查询
     */
    @RequestMapping("loadAllGoods")
    DataGridView loadAllGoods(@RequestBody GoodsVo goodsVo);

    /**
     * 添加
     */
    @RequestMapping("addGoods")
    ResultObj addGoods(@RequestBody GoodsVo goodsVo);

    /**
     * 修改
     */
    @RequestMapping("updateGoods")
    ResultObj updateGoods(@RequestBody GoodsVo goodsVo);

    /**
     * 删除
     */
    @RequestMapping("deleteGoods")
    ResultObj deleteGoods(@RequestParam("id") Integer id, @RequestParam("goodsimg") String goodsimg);

    /**
     * 加载所有可用的供应商
     */
    @RequestMapping("loadAllGoodsForSelect")
    DataGridView loadAllGoodsForSelect();

    /**
     * 根据供应商ID查询商品信息
     */
    @RequestMapping("loadGoodsByProviderId")
    DataGridView loadGoodsByProviderId(@RequestParam("providerid") Integer providerid);

    /**
     * 根据供应商ID查询商品信息
     */
    @RequestMapping("loadGoodsById")
    DataGridView loadGoodsById();

    /**
     * 根据商品id查询商品信息
     */
    @RequestMapping(value = "getGoodsByGid")
    DataGridView getGoodsByGid(@RequestParam("id") Integer id);

}
